#!/usr/bin/env python
# coding: utf-8
from flask import Flask
from flask_restful import Api
from server.views import UserAPI,tournament,Game,GameTeam,\
TeamJoinGame,ApplyTeam,AppointmentEvent,TeamPerformance,\
EventPerformance,StarTeam,StarTeamLeader,\
TeamType,CheckTeam,TeamMember,TeamPosition,\
EventManageMent,GiveALike,FocusOn,\
UpdateTeamOfEventInfo,honor,UserGame,\
CheckTeamMember,UserMesage,UserTournament,\
UserMessgeManage,CheckEvent,regist,TeamModifyMember,\
AboutMme,UserTeam,CheckUserMessge,PersonalHonor,\
CollegeAppointment,PhoneQuickeck,phonequicklogin,\
Login,authRegist,WXShare,bingauth,carouselevent,\
news,QuestionsAsked,FocusOnWe,EvnetRaceCourse,startEvent
from server.event_foreshow import EventForeshow
from emodifydb import startmodifydb
from gevent import monkey 
monkey.patch_all()
from gevent import pywsgi

app = Flask(__name__)
api = Api(app)
api.add_resource(UserAPI, '/user/')
api.add_resource(tournament, '/tournament/') ## 赛事情况
api.add_resource(Game, '/game/')
api.add_resource(GameTeam,'/gameteam/')
api.add_resource(TeamJoinGame,'/teamjoingame/')
api.add_resource(ApplyTeam,'/applyteam/')
api.add_resource(EventForeshow,'/eventforeshow/')
api.add_resource(AppointmentEvent,'/appointmentevent/')
api.add_resource(TeamPerformance,'/teamperformance/')
api.add_resource(EventPerformance,'/eventperformance/')
api.add_resource(StarTeam,'/starteam/')
api.add_resource(StarTeamLeader,'/starteamleader/')
api.add_resource(TeamType,'/teamtype/')
api.add_resource(CheckTeam,'/checkteam/')
api.add_resource(TeamMember,'/teammember/')
api.add_resource(TeamPosition,'/teamposition/')
api.add_resource(EventManageMent,'/eventmanagement/')
api.add_resource(GiveALike,'/givealike/')
api.add_resource(FocusOn,'/focuson/')
api.add_resource(UpdateTeamOfEventInfo,'/updateteamofeventinfo/')
api.add_resource(honor,'/honor/')
api.add_resource(UserGame,'/usergame/')
api.add_resource(CheckTeamMember,'/checkteammember/')
api.add_resource(UserMesage,'/usermessage/')
api.add_resource(UserTournament,'/usertournament/')
api.add_resource(UserMessgeManage,'/usermessgemanage/')
api.add_resource(regist,'/authlogin/')
api.add_resource(TeamModifyMember,'/teammodifymember/')
api.add_resource(AboutMme,'/aboutmme/')
api.add_resource(UserTeam,'/userteam/')
api.add_resource(CheckEvent,'/checkevent/')
api.add_resource(CheckUserMessge,'/checkusermessge/')
api.add_resource(PersonalHonor,'/personalhonor/')
api.add_resource(CollegeAppointment,'/collegeappointment/')
api.add_resource(PhoneQuickeck,'/phonequickeck/')
api.add_resource(phonequicklogin,'/phonequicklogin/')
api.add_resource(Login,'/login/')
api.add_resource(authRegist,'/authregist/')
api.add_resource(WXShare,'/wxshare/')
api.add_resource(bingauth,'/bingauth/')
api.add_resource(carouselevent,'/carouselevent/')
api.add_resource(news,'/news/')
api.add_resource(QuestionsAsked,'/questionsasked/')
api.add_resource(FocusOnWe,'/focusonwe/')
api.add_resource(EvnetRaceCourse,'/evnetracecourse/')
api.add_resource(startEvent,'/startevent/')
if __name__ == '__main__':

	emodifydb()
	# server = pywsgi.WSGIServer((True,'0.0.0.0', 8000), app) 
	# server.serve_forever() 
	app.run(debug=True, host='0.0.0.0', port=8088)